package com.jing.weibo.scheduler.task;

import org.quartz.JobDetail;
import org.quartz.JobExecutionContext;
import org.quartz.Scheduler;
import org.quartz.SchedulerException;
import org.quartz.Trigger;

/**
 * 抽象任务类
 * @author qian.ma
 *
 */
abstract public class AbstractTask implements ITask {
	public void removeJob(JobExecutionContext context) throws SchedulerException {
		Scheduler scheduler = context.getScheduler();
		Trigger trigger = context.getTrigger();
		JobDetail jobDetail = context.getJobDetail();
		scheduler.pauseTrigger(trigger.getName(), trigger.getGroup());
		scheduler.unscheduleJob(trigger.getName(), trigger.getGroup());
		scheduler.deleteJob(jobDetail.getName(), jobDetail.getGroup());
	}
}
